package com.zbl.zblproject.core.service;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zbl.zblproject.core.entity.*;
import com.zbl.zblproject.erp.entity.ErpGoods;
import com.zbl.zblproject.erp.entity.ErpTempOrderItem;

import java.util.List;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/16
 * 客户订单数据操作类
 */
public interface OrderService {

    /**
     * @param orderNo 订单号
     * @param userId  用户ID
     * @param operatorId 操作人ID
     * @param addressId 地址ID
     * @param list   集合
     * @param isPay 支付状态
     * @return
     */
    Order createOrder(String orderNo, int operatorId, int userId, int addressId,  int isPay, int warehouse, int isPur, int isNopur, List<ErpTempOrderItem> list, String context);

    Order updateOrder(String orderNo, int operatorId, int userId, int addressId,  int isPay, int warehouse, int isPur, int isNopur, List<ErpTempOrderItem> list);


    /**
     * 根据模式查询订单, mode == 0 查询前缀为CGDD的订单
     * mode != 0 查询前缀不为CGDD的订单
     * 根据开始时间,结束时间,门店名称,订单号来查询
     * @param mode 模式
     * @param start 开始时间
     * @param end   结束时间
     * @param name   厂家名称
     * @param orderSn 订单号
     * @return
     */
    List<FactoryOrder> getSupplierOrder(int mode, String start, String end, String name, String orderSn);


    List<FactoryOrder> getSupplierOrderListForOrderSn(int mode, String start, String end, String name, String orderSn);

    Result getSupplierOrderListForOrderSnByLimit(int mode , String start, String end, String name, String orderNo, int current, int size);


        /**
         * 模式查询订单供应商对应名称的订单
         * @param name
         * @return
         */
    FactoryOrder getSupplierOrderByName(String name, String start, String end);

    FactoryOrder getSupplierOrderByName(String name, String orderSn);

    FactoryOrder getSupplierOrderByMode2(String name, String start, String end);

    FactoryOrder getSupplierOrderByNameNotCgdd(String name);

    FactoryOrder getSupplierOrderByNameForDownloadFactoryExcel(String name, String start, String end);

    FactoryOrder getSupplierOrderByNameForDownloadFactoryExcel(String name, String orderSn);
    /**
     * 获取配货单信息
     * @param userId
     * @return
     */
    List<InvoiceOrder> getInvoiceOrderById(int userId);

    /**
     * 更具货位号排序
     * @param userId
     * @return
     */
    List<InvoiceOrder> getInvoiceOrderByIdforWh(int userId);


    /**
     * 更新订单备注
     * @param orderSn 订单号
     * @param context 订单备注
     * @return
     */
    boolean updateOrderContext(String orderSn, String context);

    boolean updateOrderConfirm(String orderSn, int status, int userId);


    /**
     * 获取订单下的商品
     * @param orderSn
     * @return
     */
    List<ErpGoods> getGoodsByOrderSn(String orderSn);

    List<UserFactoryOrder> getGoodsForOrderSnChildren(String orderSn);


    boolean updateOrderOp(Order order, String[] arrays);

    boolean orderEnded(String orderSn);

    boolean warehouseDelivery(String orderSn);

    /**
     * 获取订单的状态码
     * @param orderSn 订单号
     * @return
     */
    String orderStatus(String orderSn);

    void submitOrders(List<Integer> ids, AdminUser user);

    void submitOrderNew(List<CartItem> cartItems, AdminUser user);
}
